package org.caenv.interpreter.pojo.instructions.comparator;

import java.util.Map;
import org.caenv.interpreter.pojo.instructions.ExecutionPlan;
import org.caenv.interpreter.pojo.instructions.Instruction;

public class PushComparator implements Instruction {

    private Comparator comparator;

    @Override
    public boolean build(Map<String, String> attributes) {
        
        try{
            comparator = new Comparator(attributes);
        }catch (IllegalArgumentException e){
            return false;
        }

        return true;
    }

    @Override
    public boolean execute(ExecutionPlan executionPlan) {
        executionPlan.pushComparator(comparator);
        return true;
    }

}
